<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
            //.创建字符串
            var str1 = "hello"
            var str2 = new String("word")
            var str3 = String("你好")
            console.log(str1,str2,str3)
            console.log(str1.length)
            var str4 = "hello word"
            console.log(str4.length)
            //遍历字符串
            for(var i = 0;i < str4.length;i++){
                console.log(str4[i])

            }
            for(var i = 0;i<100;i++){
                console.log("重复");

            }
            //转换大小写字母
            var str5 = "Hello World"
            console.log(str5,str5.toUpperCase())
            console.log(str5,str5.toLowerCase())

            //获取字符
            var s1 = str5.charAt(5);
            var s2 = str5.charAt(6);
            var code1 = str5.charCodeAt(0);
            var code2 = str5.charCodeAt(5);
            console.log(s1,s2,code1,code2)

            // //获取下标
            // var index1 = str5.indexOf("l");
            // console.log(index1)
            // var index2 = str5.indexOf("l",4)
            // console.log(index2)

            // var index3 = str5.lastIndexOf("l")
            // console.log(index3)
            // var index4 = str5.lastIndexOf("l",6)
            // console.log(index4)

            // //截取字符串
            // var r3 = str5.substring(0,3);
            // console.log(r3)
            // var r4 = str5.substring(3);
            // console.log(r4)

            // //.分割字符串
            // var str6 = "2011-12-12";
            // var arr1 = str6.split("-");
            // console.log(arr1);
            // var arr2 = str6.split("/");
            // console.log(arr2);

    </script>
</head>

<body>
    
</body>
</html>